<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      /*
      reduceRight() 方法的功能和reduce()功能是一样的，不同的是reduceRight() 从数组的末尾向前将数组中的数组项做累加。
     */
      (function () {
        let arr = [2, 2, 3];
        let res = arr.reduceRight((prev, cur, index, arr) => {
          return prev ** cur;
        });
        console.log(res); //81
      })();
    </script>
  </body>
</html>
